from pywebio3 import start_server
from pywebio3.input import input_group, radio, checkbox, input
from pywebio3.output import put_text, put_markdown


def survey():
    data = input_group("简单问卷调查", [
        input("你的名字", name="name"),
        input("你的年龄", name="age", type="number"),
        radio("你最喜欢的编程语言", options=["Python", "Java", "JavaScript", "C++", "其他"], name="language"),
        checkbox("你使用过哪些开发工具", options=["PyCharm", "VS Code", "Eclipse", "IntelliJ IDEA", "其他"], name="tools")
    ])
    put_markdown(f"**{data['name']}**，{data['age']}岁，最喜欢的编程语言是 **{data['language']}**，使用过的开发工具：{', '.join(data['tools'])}")


if __name__ == "__main__":
    start_server(survey, port=8080, debug=True)